<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/1/12
 * Time: 20:06
 */
base::load_class('memcache_d');
base::load_class('model');
class navigation_model extends model{
 private $m;
    public function __construct(){
        $this->config = base::load_config('database');
        $this->table = 'class';
        $this->seting = 'default';
        $m_config = base::load_config('memcached');
        $this->m = new memcache_d($m_config,$this->table);
        parent::__construct();
    }
    public function selectCached($data='*',$where='',$order='',$limit='',$group=''){
        $keydata = $data =='*'?'*':implode($data);
        $key = $keydata.$this->table.$where.$order.$limit.$group;
        $rs = $this->m->get($key);
        //print_r($rs);
        //$this->m->delete($key);
        if(!$rs){
            $rs = $this->select($data,$where,$order,$limit,$group);
            $this->m->add($key,$rs);
            return $rs;
        }
        return $rs;
    }

}